package org.neuedu.config;

import org.neuedu.common.ResultJson;
import org.neuedu.exception.LzwException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class DefaultException {
    @ExceptionHandler
    public ResultJson defaultExceptionHandler(Exception ex) {
        ex.printStackTrace();
        if (ex instanceof LzwException){
            return ResultJson.failed(ex.getMessage());
        }
        return ResultJson.failed("系统异常");
    }
}
